# config.ru
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8

require './config/database'
require './app/routes/users_route'
require './app/routes/orders_route'
require 'rack/cors'

use Rack::Cors do
  allow do
    origins '*'  # 可以设置特定的域名，例如 'example.com'
    resource '*',
      headers: :any,
      methods: [:get, :post, :put, :delete, :options],
      expose: ['Authorization'],  # 可选项，允许前端访问的响应头
      max_age: 600
  end
end

run UsersRoute